//request 是一个axios对象（经过设置信息的）
import request from '@/utils/request'

export function login(data) {
    return request({
        url: '/api/admin/login',
        //post请求
        method: 'post',
        data
    })
}


export function getCode(){
    return request({
        url: '/api/admin/get',
        method: 'get'
    })
}

export function logout() {
    return request({
        url: '/api/admin/logout',
        //get请求
        method: 'get'
    })
}

export function abc(params) {
    return request({
        url: '/api/user/abc',
        //get请求
        method: 'get',
        params
    })
}


export function getUsers(data) {
    return request({
        //设置请求数据格式为json
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/user/logout',
        method: 'post',
        data
    })
}

//上传图片
export function uploadImage(data) {
    return request({
        //设置请求数据格式为multipart/form-data
        headers: {"Content-Type": "multipart/form-data;charset=UTF-8"},
        url: '/api/user/image/upload',
        method: 'post',
        data
    })
}

export function all() {
    return request({
        url: '/api/user/all',
        //post请求
        method: 'post'
    })
}

export function page(data) {
    return request({
        url: '/api/admin/dish/page',
        //post请求
        method: 'post',
        data
    })
}


export function searchPage(data) {
    return request({
        url: '/api/admin/users/search/fromUser',
        //post请求
        method: 'post',
        data
    })
}


export function remove(data) {
    return request({
        url: '/api/admin/users/delete',
        headers: {'Content-Type': 'application/json'},
        //post请求
        method: 'post',
        data
    })
}


export function add(data) {
    return request({
        url: '/api/admin/users/add',
        //post请求
        method: 'post',
        data
    })
}

export function update(data) {
    return request({
        url: '/api/admin/users/update',
        //post请求
        method: 'post',
        data
    })
}


export function cancel(data) {
    return request({
        url: '/api/admin/users/cancel',
        //post请求
        method: 'post',
        data
    })
}

export function find(data) {
    return request({
        url: '/api/admin/users/findUser',
        //post请求
        method: 'post',
        data
    })
}

export function getUserById(data) {
    return request({
        url: '/api/admin/users/findUser',
        //post请求
        method: 'post',
        data
    })
}



export function findAll() {
    return request({
        url: '/api/admin/users/list',
        //post请求
        method: 'post',
    })
}
